package com.qf.controller;

import com.qf.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author lenovo
 * @version V1.0
 * @Date 2021/11/25 18:53
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private EsService esService;

    /**
     * 根据条件查询日志集合数据返回
     * @param paras
     */
    @RequestMapping(value = "/search", method = RequestMethod.POST)
    public  List<Map> searchLog(@RequestParam("params") String paras) throws Exception {

        return esService.searchLog(paras);
    };

    /**
     * 根据条件查询日志总条数
     * @param paras
     */
    @RequestMapping(value = "/searchcount", method = RequestMethod.POST)
    public Long searchLogCount(@RequestParam("params") String paras) throws IOException {

        return esService.searchLogCount(paras);
    };

    /**
     * 统计报表查询
     * @param paras
     */
    @RequestMapping(value = "/statStatus", method = RequestMethod.POST)
    public Map<String, Long> statSendStatus(@RequestParam("params") String paras) throws Exception {

        return esService.statSendStatus(paras);
    };

}
